{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "from statsmodels.stats.multitest import multipletests\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATH = r'E:\\Miguel\\PhD\\Results\\Competition\\DL\\Four-Arena Setup\\WT_mating_status\\processed'\n",
    "FPS = 60\n",
    "N_MINUTES = 60\n",
    "N_FRAMES = N_MINUTES * 60 * FPS\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='talk',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.2,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [4.0, 4.0],\n",
    "            'figure.titlesize': 18.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'patch.linewidth': 1.0,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.2,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figureS2')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print('New folder created.')\n",
    "except FileExistsError:\n",
    "    print('Folder already exists, skipping.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['virgin_virgin', 'virgin_mated24h', 'virgin_mated2h']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['video_2017-09-05T14_34_55_arena4', 'video_2017-09-12T14_36_55_arena4', 'video_2017-09-14T13_34_41_arena2', 'video_2017-09-21T14_47_10_arena3', 'video_2017-09-21T14_47_10_arena4', 'video_2017-09-26T13_40_19_arena4', 'video_2017-09-27T16_21_07_arena1', 'video_2017-09-27T16_21_07_arena3', 'video_2017-09-28T15_55_49_arena2', 'video_2017-10-12T14_34_41_arena2', 'video_2017-10-18T14_05_05_arena3', 'video_2017-10-19T14_58_20_arena1', 'video_2017-10-24T14_48_34_arena1', 'video_2017-10-24T14_48_34_arena4', 'video_2017-10-25T13_39_35_arena4', 'video_2017-11-03T14_54_45_arena2', 'video_2017-09-05T15_42_04_arena1', 'video_2017-11-02T16_11_06_arena1', 'video_2017-12-19T16_23_33_arena4', 'video_2017-09-05T15_42_04_arena3', 'video_2017-09-07T13_28_02_arena4']\n",
      "21\n"
     ]
    }
   ],
   "source": [
    "# Create a list of all the experiments that we DO NOT want to analyze.\n",
    "intruders = []\n",
    "for condition in conditions:\n",
    "    for file in os.listdir(condition):\n",
    "        if 'quality_control' in file:\n",
    "\n",
    "            # Read the quality.csv file to check which experiments are usable for analysis.\n",
    "            quality_file = os.path.join(condition, file)\n",
    "            quality_df = pd.read_csv(quality_file, usecols=[0,1], index_col=0)\n",
    "            quality_df = quality_df[quality_df['is_usable'] == False].index.values\n",
    "\n",
    "            for value in quality_df:\n",
    "                intruders.append(value)\n",
    "\n",
    "print(intruders)             \n",
    "print(len(intruders))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " virgin_mated24h\n",
      "Copulation too short: video_2017-09-20T14_48_55_arena3\n",
      "\t\n",
      " virgin_mated2h\n",
      "\t\n",
      " virgin_virgin\n",
      "Copulation too short: video_2017-09-06T13_42_13_arena3\n",
      "Copulation too short: video_2017-09-26T14_52_18_arena3\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'virgin_virgin': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T13_28_41_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T14_34_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T13_42_13_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T14_45_32_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-08T13_26_13_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T13_30_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T14_36_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T16_18_15_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-13T14_34_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T13_43_53_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T14_48_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T13_38_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T15_57_23_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-26T13_40_19_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T13_36_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T14_44_01_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T15_55_49_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-12T15_50_43_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-13T16_06_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-18T15_19_17_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-19T13_50_56_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T13_21_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T15_44_09_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-24T16_13_35_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-25T14_55_12_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T13_37_48_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T14_48_28_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T16_11_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T14_54_45_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T16_20_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T12_58_51_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T14_01_01_arena3'],\n",
       " 'virgin_mated24h': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-05T13_28_41_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-07T16_01_26_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-08T14_31_59_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-08T14_31_59_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-12T13_30_06_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-13T15_40_03_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-14T14_47_16_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-20T13_43_53_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-26T14_52_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-27T15_06_20_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-11T13_30_05_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-11T16_00_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T13_50_56_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T14_58_20_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T16_19_37_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-20T14_31_24_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-20T14_31_24_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-24T13_43_26_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T13_39_35_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T14_55_12_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T14_55_12_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-26T13_35_36_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-26T14_43_16_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T16_20_50_arena3'],\n",
       " 'virgin_mated2h': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-06T15_53_34_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-07T16_01_26_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-07T16_01_26_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-08T15_42_18_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-08T15_42_18_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-13T15_40_03_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-14T15_53_40_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-20T16_07_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-21T15_57_23_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-21T15_57_23_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-26T16_06_31_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-26T16_06_31_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-28T15_55_49_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-12T15_50_43_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-13T16_06_33_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-18T16_37_02_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-18T16_37_02_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-19T16_19_37_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-19T16_19_37_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-25T16_23_26_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-25T16_23_26_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-11-02T16_11_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T15_13_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T15_13_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-20T15_08_53_arena2']}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    \n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "    \n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.is_dir() and item.name not in intruders:\n",
    "            \n",
    "            annotation_video = annotations.read(item.path + '.csv')\n",
    "            \n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "\n",
    "                # Filter out videos where copulation is interrupted.\n",
    "                copulation_end = copulation.time_interval[1]\n",
    "                if copulation_end==N_FRAMES:\n",
    "                    print('Copulation interrupted:', item.name)\n",
    "                    continue\n",
    "\n",
    "                # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                copulation_duration = copulation.duration\n",
    "                if copulation_duration <= 8 * 60 * FPS:\n",
    "                    print('Copulation too short:', item.name)\n",
    "                    continue\n",
    "            \n",
    "            except IndexError:\n",
    "                continue\n",
    "            \n",
    "            experiments[condition].append(item.path)\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get distance walked per frame (in mm) from the start of each video until the end of copulation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "virgin_virgin\n",
      "video_2017-09-05T13_28_41_arena4\n",
      "video_2017-09-05T14_34_55_arena2\n",
      "video_2017-09-06T13_42_13_arena1\n",
      "video_2017-09-06T14_45_32_arena3\n",
      "video_2017-09-07T14_37_38_arena3\n",
      "video_2017-09-07T14_37_38_arena4\n",
      "video_2017-09-08T13_26_13_arena3\n",
      "video_2017-09-12T13_30_06_arena4\n",
      "video_2017-09-12T14_36_55_arena3\n",
      "video_2017-09-12T16_18_15_arena4\n",
      "video_2017-09-13T14_34_18_arena2\n",
      "video_2017-09-20T13_43_53_arena3\n",
      "video_2017-09-20T14_48_55_arena2\n",
      "video_2017-09-21T13_38_55_arena4\n",
      "video_2017-09-21T15_57_23_arena2\n",
      "video_2017-09-26T13_40_19_arena1\n",
      "video_2017-09-28T13_36_06_arena4\n",
      "video_2017-09-28T14_44_01_arena3\n",
      "video_2017-09-28T15_55_49_arena3\n",
      "video_2017-10-12T15_50_43_arena2\n",
      "video_2017-10-13T16_06_33_arena2\n",
      "video_2017-10-18T15_19_17_arena3\n",
      "video_2017-10-19T13_50_56_arena2\n",
      "video_2017-10-20T13_21_06_arena2\n",
      "video_2017-10-20T15_44_09_arena2\n",
      "video_2017-10-24T16_13_35_arena4\n",
      "video_2017-10-25T14_55_12_arena1\n",
      "video_2017-11-02T13_37_48_arena3\n",
      "video_2017-11-02T14_48_28_arena4\n",
      "video_2017-11-02T16_11_06_arena3\n",
      "video_2017-11-03T14_54_45_arena1\n",
      "video_2017-11-03T16_20_50_arena4\n",
      "video_2017-12-20T12_58_51_arena4\n",
      "video_2017-12-20T14_01_01_arena3\n",
      "virgin_mated24h\n",
      "video_2017-09-05T13_28_41_arena3\n",
      "video_2017-09-07T16_01_26_arena4\n",
      "video_2017-09-08T14_31_59_arena2\n",
      "video_2017-09-08T14_31_59_arena3\n",
      "video_2017-09-12T13_30_06_arena1\n",
      "video_2017-09-13T15_40_03_arena1\n",
      "video_2017-09-14T14_47_16_arena4\n",
      "video_2017-09-20T13_43_53_arena1\n",
      "video_2017-09-26T14_52_18_arena2\n",
      "video_2017-09-27T15_06_20_arena3\n",
      "video_2017-10-11T13_30_05_arena1\n",
      "video_2017-10-11T16_00_50_arena4\n",
      "video_2017-10-13T14_37_35_arena1\n",
      "video_2017-10-13T14_37_35_arena2\n",
      "video_2017-10-13T14_37_35_arena3\n",
      "video_2017-10-19T13_50_56_arena4\n",
      "video_2017-10-19T14_58_20_arena3\n",
      "video_2017-10-19T16_19_37_arena2\n",
      "video_2017-10-20T14_31_24_arena3\n",
      "video_2017-10-20T14_31_24_arena4\n",
      "video_2017-10-24T13_43_26_arena3\n",
      "video_2017-10-25T13_39_35_arena1\n",
      "video_2017-10-25T14_55_12_arena2\n",
      "video_2017-10-25T14_55_12_arena3\n",
      "video_2017-10-26T13_35_36_arena2\n",
      "video_2017-10-26T14_43_16_arena3\n",
      "video_2017-11-03T13_38_06_arena2\n",
      "video_2017-11-03T13_38_06_arena3\n",
      "video_2017-11-03T13_38_06_arena4\n",
      "video_2017-11-03T16_20_50_arena3\n",
      "virgin_mated2h\n",
      "video_2017-09-06T15_53_34_arena1\n",
      "video_2017-09-07T16_01_26_arena1\n",
      "video_2017-09-07T16_01_26_arena2\n",
      "video_2017-09-08T15_42_18_arena1\n",
      "video_2017-09-08T15_42_18_arena3\n",
      "video_2017-09-13T15_40_03_arena4\n",
      "video_2017-09-14T15_53_40_arena3\n",
      "video_2017-09-20T16_07_55_arena4\n",
      "video_2017-09-21T15_57_23_arena1\n",
      "video_2017-09-21T15_57_23_arena4\n",
      "video_2017-09-26T16_06_31_arena1\n",
      "video_2017-09-26T16_06_31_arena3\n",
      "video_2017-09-28T15_55_49_arena1\n",
      "video_2017-10-11T16_00_50_arena1\n",
      "video_2017-10-11T16_00_50_arena2\n",
      "video_2017-10-11T16_00_50_arena3\n",
      "video_2017-10-12T15_50_43_arena4\n",
      "video_2017-10-13T16_06_33_arena4\n",
      "video_2017-10-18T16_37_02_arena3\n",
      "video_2017-10-18T16_37_02_arena4\n",
      "video_2017-10-19T16_19_37_arena1\n",
      "video_2017-10-19T16_19_37_arena4\n",
      "video_2017-10-25T16_23_26_arena1\n",
      "video_2017-10-25T16_23_26_arena3\n",
      "video_2017-11-02T16_11_06_arena4\n",
      "video_2017-12-19T15_13_55_arena2\n",
      "video_2017-12-19T15_13_55_arena3\n",
      "video_2017-12-19T16_23_33_arena1\n",
      "video_2017-12-19T16_23_33_arena2\n",
      "video_2017-12-19T16_23_33_arena3\n",
      "video_2017-12-20T15_08_53_arena2\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>pos_x</th>\n",
       "      <th>pos_y</th>\n",
       "      <th>vel</th>\n",
       "      <th>copulation</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>dist_walked_mm</th>\n",
       "      <th>dist_walked_meters</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>161.99</td>\n",
       "      <td>86.105</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>before</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>True</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>161.99</td>\n",
       "      <td>86.105</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>before</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>True</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>161.99</td>\n",
       "      <td>86.105</td>\n",
       "      <td>0.19732</td>\n",
       "      <td>before</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>True</td>\n",
       "      <td>0.003289</td>\n",
       "      <td>0.000003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>161.92</td>\n",
       "      <td>86.194</td>\n",
       "      <td>0.64946</td>\n",
       "      <td>before</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>True</td>\n",
       "      <td>0.010824</td>\n",
       "      <td>0.000011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>161.71</td>\n",
       "      <td>86.145</td>\n",
       "      <td>1.97140</td>\n",
       "      <td>before</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>True</td>\n",
       "      <td>0.032857</td>\n",
       "      <td>0.000033</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100458</th>\n",
       "      <td>173.69</td>\n",
       "      <td>103.980</td>\n",
       "      <td>2.62200</td>\n",
       "      <td>during</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>True</td>\n",
       "      <td>0.043700</td>\n",
       "      <td>0.000044</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100459</th>\n",
       "      <td>173.45</td>\n",
       "      <td>103.860</td>\n",
       "      <td>1.80180</td>\n",
       "      <td>during</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>True</td>\n",
       "      <td>0.030030</td>\n",
       "      <td>0.000030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100460</th>\n",
       "      <td>173.35</td>\n",
       "      <td>103.590</td>\n",
       "      <td>1.65710</td>\n",
       "      <td>during</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>True</td>\n",
       "      <td>0.027618</td>\n",
       "      <td>0.000028</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100461</th>\n",
       "      <td>173.34</td>\n",
       "      <td>103.380</td>\n",
       "      <td>1.81800</td>\n",
       "      <td>during</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>True</td>\n",
       "      <td>0.030300</td>\n",
       "      <td>0.000030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100462</th>\n",
       "      <td>173.27</td>\n",
       "      <td>103.020</td>\n",
       "      <td>1.50940</td>\n",
       "      <td>during</td>\n",
       "      <td>virgin_mated2h</td>\n",
       "      <td>video_2017-12-20T15_08_53_arena2</td>\n",
       "      <td>True</td>\n",
       "      <td>0.025157</td>\n",
       "      <td>0.000025</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8275032 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         pos_x    pos_y      vel copulation       condition  \\\n",
       "0       161.99   86.105  0.00000     before   virgin_virgin   \n",
       "1       161.99   86.105  0.00000     before   virgin_virgin   \n",
       "2       161.99   86.105  0.19732     before   virgin_virgin   \n",
       "3       161.92   86.194  0.64946     before   virgin_virgin   \n",
       "4       161.71   86.145  1.97140     before   virgin_virgin   \n",
       "...        ...      ...      ...        ...             ...   \n",
       "100458  173.69  103.980  2.62200     during  virgin_mated2h   \n",
       "100459  173.45  103.860  1.80180     during  virgin_mated2h   \n",
       "100460  173.35  103.590  1.65710     during  virgin_mated2h   \n",
       "100461  173.34  103.380  1.81800     during  virgin_mated2h   \n",
       "100462  173.27  103.020  1.50940     during  virgin_mated2h   \n",
       "\n",
       "                              experiment  has_aggression  dist_walked_mm  \\\n",
       "0       video_2017-09-05T13_28_41_arena4            True        0.000000   \n",
       "1       video_2017-09-05T13_28_41_arena4            True        0.000000   \n",
       "2       video_2017-09-05T13_28_41_arena4            True        0.003289   \n",
       "3       video_2017-09-05T13_28_41_arena4            True        0.010824   \n",
       "4       video_2017-09-05T13_28_41_arena4            True        0.032857   \n",
       "...                                  ...             ...             ...   \n",
       "100458  video_2017-12-20T15_08_53_arena2            True        0.043700   \n",
       "100459  video_2017-12-20T15_08_53_arena2            True        0.030030   \n",
       "100460  video_2017-12-20T15_08_53_arena2            True        0.027618   \n",
       "100461  video_2017-12-20T15_08_53_arena2            True        0.030300   \n",
       "100462  video_2017-12-20T15_08_53_arena2            True        0.025157   \n",
       "\n",
       "        dist_walked_meters  \n",
       "0                 0.000000  \n",
       "1                 0.000000  \n",
       "2                 0.000003  \n",
       "3                 0.000011  \n",
       "4                 0.000033  \n",
       "...                    ...  \n",
       "100458            0.000044  \n",
       "100459            0.000030  \n",
       "100460            0.000028  \n",
       "100461            0.000030  \n",
       "100462            0.000025  \n",
       "\n",
       "[8275032 rows x 9 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "total_distance = []\n",
    "distance_during_copulation = {condition: {} for condition in condition_order}\n",
    "distance_before_copulation = {condition: {} for condition in condition_order}\n",
    "distance_df = pd.DataFrame()\n",
    "\n",
    "# Set features to extract from trackfeat files.\n",
    "features = ['pos x', 'pos y', 'vel']\n",
    "\n",
    "for condition in condition_order:\n",
    "    \n",
    "    print(condition)\n",
    "    \n",
    "    for experiment_path in experiments[condition]:\n",
    "        \n",
    "        control = True if condition == 'virgin_virgin' else False\n",
    "\n",
    "        aggression_df, mating_df, copulation_time, aggression_timepoints = helpers.process_track_data(experiment_path,\n",
    "                                                                                                      include_aggression_only=False,\n",
    "                                                                                                      fly_id=2,\n",
    "                                                                                                      is_control=control,\n",
    "                                                                                                      trackfeat_columns=features,\n",
    "                                                                                                      suppress=True\n",
    "                                                                                                     )\n",
    "        if aggression_df is None or mating_df is None:\n",
    "            continue\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "        \n",
    "        print(experiment)\n",
    "\n",
    "        # Slice the aggressive female's data only up until end of copulation - we do not care about what happens after that.\n",
    "        copulation_start = copulation_time[0]\n",
    "        copulation_end = copulation_time[1]\n",
    "        aggression_slice = aggression_df.loc[:copulation_end-1, :].copy()\n",
    "        aggression_slice.fillna(method='ffill', inplace=True)\n",
    "        aggression_slice = aggression_slice[aggression_slice['vel'] < 20]  # Filter out jumps.\n",
    "\n",
    "        # Categorize frames from before copulation or duting copulation so we can later compare these two moments.\n",
    "        aggression_slice['copulation'] = aggression_slice.index < copulation_start\n",
    "        aggression_slice['copulation'] = aggression_slice['copulation'].map({True: 'before', False: 'during'})\n",
    "        aggression_slice['condition'] = condition\n",
    "        aggression_slice['experiment'] = experiment\n",
    "        aggression_slice['has_aggression'] = True if len(aggression_timepoints) > 0 else False\n",
    "\n",
    "        aggression_during_copulation = aggression_df.loc[copulation_start:copulation_end-1, :].copy()\n",
    "        aggression_during_copulation.fillna(method='ffill', inplace=True)\n",
    "        aggression_before_copulation = aggression_df.loc[:copulation_start-1, :].copy()\n",
    "        aggression_before_copulation.fillna(method='ffill', inplace=True)\n",
    "\n",
    "        # Calculate distance walked per frame based on the velocity column.\n",
    "        aggression_slice['dist_walked_mm'] = (aggression_slice['vel'] / 60)\n",
    "        aggression_slice['dist_walked_meters'] = (aggression_slice['vel'] / 60 / 1000)\n",
    "        aggression_during_copulation['dist_walked_mm'] = (aggression_during_copulation['vel'] / 60)\n",
    "        aggression_before_copulation['dist_walked_mm'] = (aggression_before_copulation['vel'] / 60)\n",
    "        \n",
    "        total_distance.append(sum(aggression_slice['dist_walked_mm']))\n",
    "        distance_during_copulation[condition][experiment] = sum(aggression_during_copulation['dist_walked_mm'])\n",
    "        distance_before_copulation[condition][experiment] = sum(aggression_before_copulation['dist_walked_mm'])\n",
    "\n",
    "        distance_df = pd.concat([distance_df, aggression_slice], axis=0)\n",
    "\n",
    "distance_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>pos_x</th>\n",
       "      <th>pos_y</th>\n",
       "      <th>vel</th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>dist_walked_mm</th>\n",
       "      <th>dist_walked_meters</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena3</td>\n",
       "      <td>1.536981e+07</td>\n",
       "      <td>1.684179e+07</td>\n",
       "      <td>565503.122424</td>\n",
       "      <td>0.0</td>\n",
       "      <td>9425.052040</td>\n",
       "      <td>9.425052</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-07T16_01_26_arena4</td>\n",
       "      <td>1.569941e+07</td>\n",
       "      <td>1.569519e+07</td>\n",
       "      <td>454586.350065</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7576.439168</td>\n",
       "      <td>7.576439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-08T14_31_59_arena2</td>\n",
       "      <td>1.199031e+07</td>\n",
       "      <td>1.093266e+07</td>\n",
       "      <td>354113.452806</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5901.890880</td>\n",
       "      <td>5.901891</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-08T14_31_59_arena3</td>\n",
       "      <td>1.111254e+07</td>\n",
       "      <td>1.272907e+07</td>\n",
       "      <td>315779.688209</td>\n",
       "      <td>59403.0</td>\n",
       "      <td>5262.994803</td>\n",
       "      <td>5.262995</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-12T13_30_06_arena1</td>\n",
       "      <td>2.182715e+07</td>\n",
       "      <td>2.181400e+07</td>\n",
       "      <td>776363.427397</td>\n",
       "      <td>113256.0</td>\n",
       "      <td>12939.390457</td>\n",
       "      <td>12.939390</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T16_11_06_arena3</td>\n",
       "      <td>1.680257e+07</td>\n",
       "      <td>1.717971e+07</td>\n",
       "      <td>474072.728796</td>\n",
       "      <td>84193.0</td>\n",
       "      <td>7901.212147</td>\n",
       "      <td>7.901212</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T14_54_45_arena1</td>\n",
       "      <td>8.567400e+06</td>\n",
       "      <td>9.095781e+06</td>\n",
       "      <td>326104.065283</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5435.067755</td>\n",
       "      <td>5.435068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T16_20_50_arena4</td>\n",
       "      <td>1.998000e+07</td>\n",
       "      <td>2.036970e+07</td>\n",
       "      <td>710729.939317</td>\n",
       "      <td>101285.0</td>\n",
       "      <td>11845.498989</td>\n",
       "      <td>11.845499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T12_58_51_arena4</td>\n",
       "      <td>1.901919e+07</td>\n",
       "      <td>1.845194e+07</td>\n",
       "      <td>648959.570321</td>\n",
       "      <td>94206.0</td>\n",
       "      <td>10815.992839</td>\n",
       "      <td>10.815993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T14_01_01_arena3</td>\n",
       "      <td>1.261258e+07</td>\n",
       "      <td>1.817302e+07</td>\n",
       "      <td>419533.919242</td>\n",
       "      <td>86033.0</td>\n",
       "      <td>6992.231987</td>\n",
       "      <td>6.992232</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>95 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          condition                        experiment         pos_x  \\\n",
       "0   virgin_mated24h  video_2017-09-05T13_28_41_arena3  1.536981e+07   \n",
       "1   virgin_mated24h  video_2017-09-07T16_01_26_arena4  1.569941e+07   \n",
       "2   virgin_mated24h  video_2017-09-08T14_31_59_arena2  1.199031e+07   \n",
       "3   virgin_mated24h  video_2017-09-08T14_31_59_arena3  1.111254e+07   \n",
       "4   virgin_mated24h  video_2017-09-12T13_30_06_arena1  2.182715e+07   \n",
       "..              ...                               ...           ...   \n",
       "90    virgin_virgin  video_2017-11-02T16_11_06_arena3  1.680257e+07   \n",
       "91    virgin_virgin  video_2017-11-03T14_54_45_arena1  8.567400e+06   \n",
       "92    virgin_virgin  video_2017-11-03T16_20_50_arena4  1.998000e+07   \n",
       "93    virgin_virgin  video_2017-12-20T12_58_51_arena4  1.901919e+07   \n",
       "94    virgin_virgin  video_2017-12-20T14_01_01_arena3  1.261258e+07   \n",
       "\n",
       "           pos_y            vel  has_aggression  dist_walked_mm  \\\n",
       "0   1.684179e+07  565503.122424             0.0     9425.052040   \n",
       "1   1.569519e+07  454586.350065             0.0     7576.439168   \n",
       "2   1.093266e+07  354113.452806             0.0     5901.890880   \n",
       "3   1.272907e+07  315779.688209         59403.0     5262.994803   \n",
       "4   2.181400e+07  776363.427397        113256.0    12939.390457   \n",
       "..           ...            ...             ...             ...   \n",
       "90  1.717971e+07  474072.728796         84193.0     7901.212147   \n",
       "91  9.095781e+06  326104.065283             0.0     5435.067755   \n",
       "92  2.036970e+07  710729.939317        101285.0    11845.498989   \n",
       "93  1.845194e+07  648959.570321         94206.0    10815.992839   \n",
       "94  1.817302e+07  419533.919242         86033.0     6992.231987   \n",
       "\n",
       "    dist_walked_meters  \n",
       "0             9.425052  \n",
       "1             7.576439  \n",
       "2             5.901891  \n",
       "3             5.262995  \n",
       "4            12.939390  \n",
       "..                 ...  \n",
       "90            7.901212  \n",
       "91            5.435068  \n",
       "92           11.845499  \n",
       "93           10.815993  \n",
       "94            6.992232  \n",
       "\n",
       "[95 rows x 8 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Sum distance walked during all frames for each video and convert that to meters.\n",
    "experiments_grouped = distance_df.groupby(by=['condition', 'experiment'], as_index=False).sum()\n",
    "experiments_grouped"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Do females walk more before copulation than during copulation?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>copulation</th>\n",
       "      <th>pos_x</th>\n",
       "      <th>pos_y</th>\n",
       "      <th>vel</th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>dist_walked_mm</th>\n",
       "      <th>dist_walked_meters</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena3</td>\n",
       "      <td>before</td>\n",
       "      <td>7998789.547</td>\n",
       "      <td>8992949.015</td>\n",
       "      <td>357479.311849</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5957.988531</td>\n",
       "      <td>5.957989</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena3</td>\n",
       "      <td>during</td>\n",
       "      <td>7371021.772</td>\n",
       "      <td>7848837.312</td>\n",
       "      <td>208023.810574</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3467.063510</td>\n",
       "      <td>3.467064</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-07T16_01_26_arena4</td>\n",
       "      <td>before</td>\n",
       "      <td>6558872.074</td>\n",
       "      <td>6168837.749</td>\n",
       "      <td>185226.712014</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3087.111867</td>\n",
       "      <td>3.087112</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-07T16_01_26_arena4</td>\n",
       "      <td>during</td>\n",
       "      <td>9140542.375</td>\n",
       "      <td>9526349.426</td>\n",
       "      <td>269359.638052</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4489.327301</td>\n",
       "      <td>4.489327</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>virgin_mated24h</td>\n",
       "      <td>video_2017-09-08T14_31_59_arena2</td>\n",
       "      <td>before</td>\n",
       "      <td>1289290.859</td>\n",
       "      <td>1188401.033</td>\n",
       "      <td>45523.732945</td>\n",
       "      <td>0.0</td>\n",
       "      <td>758.728882</td>\n",
       "      <td>0.758729</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         condition                        experiment copulation        pos_x  \\\n",
       "0  virgin_mated24h  video_2017-09-05T13_28_41_arena3     before  7998789.547   \n",
       "1  virgin_mated24h  video_2017-09-05T13_28_41_arena3     during  7371021.772   \n",
       "2  virgin_mated24h  video_2017-09-07T16_01_26_arena4     before  6558872.074   \n",
       "3  virgin_mated24h  video_2017-09-07T16_01_26_arena4     during  9140542.375   \n",
       "4  virgin_mated24h  video_2017-09-08T14_31_59_arena2     before  1289290.859   \n",
       "\n",
       "         pos_y            vel  has_aggression  dist_walked_mm  \\\n",
       "0  8992949.015  357479.311849             0.0     5957.988531   \n",
       "1  7848837.312  208023.810574             0.0     3467.063510   \n",
       "2  6168837.749  185226.712014             0.0     3087.111867   \n",
       "3  9526349.426  269359.638052             0.0     4489.327301   \n",
       "4  1188401.033   45523.732945             0.0      758.728882   \n",
       "\n",
       "   dist_walked_meters  \n",
       "0            5.957989  \n",
       "1            3.467064  \n",
       "2            3.087112  \n",
       "3            4.489327  \n",
       "4            0.758729  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Seaparte the summed distance walked for each fly before and during copulation.\n",
    "copulation_grouped = distance_df.groupby(['condition', 'experiment', 'copulation'], as_index=False).sum()\n",
    "copulation_grouped.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Outliers\n",
    "Commented out since using the \"aggression_rate_outlier_detection\" notebook."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# corrected_copulation_grouped = pd.DataFrame()\n",
    "\n",
    "# for condition in condition_order:\n",
    "    \n",
    "#     print('\\n\\t', condition, '\\n')\n",
    "\n",
    "#     try:\n",
    "    \n",
    "#         for cop in copulation_grouped['copulation'].unique():\n",
    "\n",
    "#             print(cop)\n",
    "\n",
    "#             dataset = copulation_grouped.query('condition==\"' + condition + '\" and copulation==\"' + cop + '\"')['dist_walked_meters']\n",
    "\n",
    "#             outlier_positions = helpers.check_outliers(dataset)\n",
    "#             print(outlier_positions)\n",
    "\n",
    "#             fresh_dataset = pd.DataFrame(helpers.remove_outliers(dataset, indices=outlier_positions))\n",
    "#             fresh_dataset['condition'] = condition\n",
    "\n",
    "#             corrected_copulation_grouped = pd.concat([corrected_copulation_grouped, fresh_dataset], axis=0)\n",
    "\n",
    "#     except IndexError:\n",
    "#         print('No second copulation for condition', condition)\n",
    "\n",
    "# copulation_grouped = copulation_grouped.copy().loc[corrected_copulation_grouped.index]\n",
    "# copulation_grouped"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t virgin_virgin \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS normally distributed.\n",
      "D'Agostino's Test: group 2 IS normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.116360\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.06491205077338397 \n",
      "\n",
      "\n",
      "\t virgin_mated24h \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.250901\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.048131415518075864 \n",
      "\n",
      "\n",
      "\t virgin_mated2h \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS normally distributed.\n",
      "D'Agostino's Test: group 2 IS normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.018591\n",
      "  All groups were sampled from populations with NOT IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.13302451248603875 \n",
      "\n"
     ]
    }
   ],
   "source": [
    "copulation_grouped_pvalues = {}\n",
    "\n",
    "for condition in condition_order:\n",
    "    \n",
    "    print('\\n\\t', condition, '\\n')\n",
    "    \n",
    "    try:\n",
    "        data_condition = {condition + '_no_cop': copulation_grouped.query('condition==\"' + condition + '\" and copulation==\"before\"')['dist_walked_meters'],\n",
    "                          condition + '_cop': copulation_grouped.query('condition==\"' + condition + '\" and copulation==\"during\"')['dist_walked_meters']\n",
    "                         }\n",
    "        \n",
    "        pvalue_condition = helpers.run_statistics(data_condition)\n",
    "        \n",
    "        copulation_grouped_pvalues[condition] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Bonferroni Correction\n",
      "---------------------\n",
      "\n",
      "\tOriginal Values:\n",
      " {'virgin_virgin': 0.06491205077338397, 'virgin_mated24h': 0.048131415518075864, 'virgin_mated2h': 0.13302451248603875}\n",
      "\n",
      "\tCorrected Values:\n",
      " {'virgin_virgin': 0.1947361523201519, 'virgin_mated24h': 0.14439424655422758, 'virgin_mated2h': 0.39907353745811625} \n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Bonferroni corretction for multiple comparisons.\n",
    "title = 'Bonferroni Correction'\n",
    "print(title)\n",
    "print('-'*len(title))\n",
    "\n",
    "# Show uncorrected values.\n",
    "print('\\n\\tOriginal Values:\\n', copulation_grouped_pvalues)\n",
    "\n",
    "# Apply the bonferroni correction for multiple comparisons.\n",
    "copulation_grouped_multi_comp_correction = multipletests(pvals=list(copulation_grouped_pvalues.values()), alpha=0.05, method='bonferroni')[1]\n",
    "\n",
    "# Transform the correction results into a dictionary.\n",
    "corrected_copulation_grouped_pvalues = dict(zip(list(copulation_grouped_pvalues.keys()), copulation_grouped_multi_comp_correction))\n",
    "\n",
    "# Show corrected values.\n",
    "print('\\n\\tCorrected Values:\\n', corrected_copulation_grouped_pvalues, '\\n')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "virgin_virgin\n",
      "Small Effect: 0.309004600243965 \n",
      "\n",
      "virgin_mated24h\n",
      "Small Effect: 0.2062191520171995 \n",
      "\n",
      "virgin_mated2h\n",
      "Vestigial Effect: -0.08750779521320212 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'virgin_virgin': 0.309004600243965,\n",
       " 'virgin_mated24h': 0.2062191520171995,\n",
       " 'virgin_mated2h': -0.08750779521320212}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "copulation_grouped_effect_sizes = {}\n",
    "\n",
    "for condition in condition_order:\n",
    "    \n",
    "    print(condition)\n",
    "    \n",
    "    control = copulation_grouped.query('condition==\"' + condition + '\" and copulation==\"before\"')['dist_walked_meters']\n",
    "    test = copulation_grouped.query('condition==\"' + condition + '\" and copulation==\"during\"')['dist_walked_meters']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "    \n",
    "    copulation_grouped_effect_sizes[condition] = median_diff\n",
    "    \n",
    "copulation_grouped_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEoCAYAAAB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1tYWgYGBUCqVkEql2LVrFzkHgiA6FLSCIAiCIEShR16CIAhCFHIQBEEQhCjkIAiCIAhRyEEQBEEQopCDIAiCIEQhB0EQBEGIQg6CIAiCEIUcBEEQBCEKOQiCIAhCFHIQBEEQhCjkIAiCIAhRyEEQBEEQopCDIAiCIEQhB0EQBEGIQg6CIAiCEIUcBEEQBCEKOQiCIAhCFHIQBEEQhCjkIAiCIAhRyEEQBEEQovw/6LjrDBrB1lEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 270x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = copulation_grouped['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='condition',\n",
    "            y='dist_walked_meters',\n",
    "            data=copulation_grouped,\n",
    "            order=condition_order,\n",
    "            hue='copulation',\n",
    "            hue_order=['before', 'during'],\n",
    "            showfliers=False,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            capprops={'color': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='condition',\n",
    "              y='dist_walked_meters',\n",
    "              data=copulation_grouped,\n",
    "              order=condition_order,\n",
    "              hue='copulation',\n",
    "              hue_order=['before', 'during'],\n",
    "              linewidth=1.0,\n",
    "              edgecolor=INK,\n",
    "              dodge=True\n",
    "             )\n",
    "\n",
    "# Format boxplot grouping colors and hatching.\n",
    "for b, boxplot in enumerate(axis.artists):\n",
    "    if b < 2:\n",
    "        boxplot.set_facecolor('steelblue')\n",
    "    elif b > 3:\n",
    "        boxplot.set_facecolor('#fB929e')\n",
    "    else:\n",
    "        boxplot.set_facecolor('#d72323')\n",
    "    if b % 2 != 0:\n",
    "        boxplot.set_hatch('///')\n",
    "\n",
    "# Format swarmplot grouping colors.\n",
    "for s, swarmplot in enumerate(axis.collections):\n",
    "    if s < 2:\n",
    "        swarmplot.set_facecolor('steelblue')\n",
    "    elif s > 3:\n",
    "        swarmplot.set_facecolor('#fB929e')\n",
    "    else:\n",
    "        swarmplot.set_facecolor('#d72323')\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('Distance (meters)')\n",
    "axis.set_ylim(0, 20)\n",
    "axis.set_yticks(range(0, 20+1, 5))\n",
    "\n",
    "# Legend formatting.\n",
    "legend_handles, _ = axis.get_legend_handles_labels()\n",
    "for h, handle in enumerate(legend_handles):\n",
    "    handle.set_facecolor('white')\n",
    "    handle.set_linewidth(1.0)\n",
    "    handle.set_edgecolor(INK)\n",
    "    if h > 0:\n",
    "        handle.set_hatch('///')\n",
    "\n",
    "axis.legend(handles=legend_handles[:2],\n",
    "            labels=['Before copulation', 'During copulation'],\n",
    "            title='Timing',\n",
    "            title_fontsize=13,\n",
    "            bbox_to_anchor=(1.0, 0.9)\n",
    "           )\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(copulation_grouped.query('condition==\"'+condition+'\"')['experiment'].nunique()) for condition in condition_order]\n",
    "row2 = ['virgin\\n', '24h-mated\\n', '2h-mated\\n']\n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='center',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical results.\n",
    "for p, condition in enumerate(condition_order):\n",
    "    sig_height = 6 if (corrected_copulation_grouped_pvalues.get(condition, 'NaN') == 'NaN') or (corrected_copulation_grouped_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p-0.2,\n",
    "                                 x2=p+0.2,\n",
    "                                 p_value=corrected_copulation_grouped_pvalues.get(condition, 'NaN'),\n",
    "                                 y=20,\n",
    "                                 ticksize=0.5,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'distance_walked_before_during_copulation_mating_drive'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
